package com.alili_tv.system.mapper;

import com.alili_tv.system.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.Map;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2023-03-17
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select id, name, headshot from user where id = #{userId}")
    User getUserName(long userId);

    /**
     * 通过ids获取用户信息
     * @param userIds
     * @return
     */
    @MapKey("id")
    Map<Long, User> getNameByIds(Collection<Long> userIds);
}
